NeilBrown [Fri, 27 Dec 2019 04:58:27 +0000 (15:58 +1100)]
merge2: guard against over-flowing elcnt
It should be impossible to overflow elcnt in these
cases, but I have seen it happen.
There must be bug somewhere else, but for now, just prevent the
crash.
NeilBrown [Fri, 27 Dec 2019 04:31:48 +0000 (15:31 +1100)]
vpatch: call sort_patches() before main_window().
sort_patches() can reallocate the patch list array.
So after main_window is called (which calls sort_patches())
the patchs array might have changed. We current call
plist_free() on the old patch list, which can crash.
So instead, call sort_patches() before calling main_window(),
then call plist_free() afterwards, on the patch list
that sort_patches() returned.
This avoids the crash.
NeilBrown [Sat, 3 Aug 2019 02:11:56 +0000 (12:11 +1000)]
extract: allow blank lines in unified diffs.
When a unified diff report that both files have a blank line,
it shows this as a line containing just a space.
Sometimes that space can go missing (spaces at the end of a line
are like that).
So if we find a completely empty line, treat it like a line
containing just a space.
Some compilers complain that this might be used
uninitialised. They are wrong as it is only used when 'found' is
non-zero, and it is always set before found is set, but
as I like -Werror, I need to handle bad warnings too.
NeilBrown [Wed, 16 Oct 2013 01:58:51 +0000 (12:58 +1100)]
Makefile: make it easy to suppress the "-D" flag to "install".
Some versions of "install" do not support '-D', and it isn't needed
when installing to default location.
So all
make INSTALL=install
to suppress the -D
Reported-by: Christian Sonne Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Tue, 27 Aug 2013 23:35:14 +0000 (09:35 +1000)]
Makefile: suppress error messages from 'git'.
If you have a clone of the 'wiggle' git tree but with no
tags, then "git describe HEAD" will complain
fatal: No names found, cannot describe anything.
As it produces no output, the compiled in default will be used
so this is just an unnecessary message. So send it to /dev/null.
Reported-by: Stephen Cameron @ G+ Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Fri, 23 Aug 2013 04:24:14 +0000 (14:24 +1000)]
Hack to improve view of ignore-blank conflicts.
cd tests/contrib/abstract
../../../wiggle -Bb orig new new2
select the "central" and type 'x' so it disappears and note
that the only remaining difference is that "computational"
has been deleted.
Without this patch you only see one '-' line and no '+' line.
However the result isn't perfect as
./wiggle -Bp demo.patch
visit the README file
page down to waht "You can use 'o' ..." as added.
And note that there is a '-' blank line and a '+' blank line.
These are unwanted and added by this patch.
NeilBrown [Wed, 21 Aug 2013 01:40:59 +0000 (11:40 +1000)]
Preserve per-hunk "comment" field.
Each diff/patch hunk can have a comment, often a function
name extract with "diff -p".
Preserver that comment and display it when we print hunk headers,
particularly in the browser.
NeilBrown [Mon, 19 Aug 2013 05:03:37 +0000 (15:03 +1000)]
merge: fix reporting of empty "conflicts".
The important part of this patch is the end in print_merge().
If one conflict follows another with nothing in between,
then we really should try to mark up that 'nothingness' as
a resolved conflict.
The other parts as just cleaning up isolate_conflicts a bit more
as I tried to figure out what was happening.
NeilBrown [Mon, 19 Aug 2013 01:15:53 +0000 (11:15 +1000)]
Browser: Don't highlight spaces so much.
Highlighting spaces is very noisy and doesn't help very much.
We only really need to differentiate spaces from tabs and highlighting
tabs is enough for that.
We continue to highlight spaces that are adjacent to tabs, but not
other spaces.
NeilBrown [Thu, 28 Mar 2013 01:53:57 +0000 (12:53 +1100)]
Extract version information from 'git' if possible.
The version number (and date) reported by "wiggle -V" now
includes information from 'git' if the code was build from a
git repo rather than from a tar-ball.
Suggested-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Fri, 22 Mar 2013 04:12:49 +0000 (15:12 +1100)]
merge: be more careful about aligning hunk-headers with newlines.
When matching a diff to a file, it would be very confusing.
if the last match from one hunk were on the same line of the
original as the first match of the next hunk.
So we try to align hunk-headers with newlines.
In particular, we often find Unmatched and Extraneous
sections together. There can be encoded in any order.
If the Extraneous section contains a hunk-header,
we want to make sure that if there is a newline anywhere
in the unmatched section, then the Unmatched that is placed
before the hunk-headers Extraneous ends on a newline.
There was code the attempted this, but it was too simplistic
and would sometimes move outside the regions that it should
have been examine, which would lead to various bugs.
The tests case which demonstrated this is added to the
test suite.
Reported-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: NeilBrown <neilb@suse.de>
NeilBrown [Fri, 22 Mar 2013 04:04:48 +0000 (15:04 +1100)]
csl_join should merge adjacent matches.
When diffing against a patch we treat each hunk separately
and join the result.
This joining doesn't merge adjacent matches so it doesn't really
tell the full story of where the matches are and how big
they are. This can confuse other code, particularly when
examining hunk headers to create the merger.
NeilBrown [Fri, 1 Mar 2013 08:09:35 +0000 (19:09 +1100)]
vpatch: allow a word to have text before the newline.
Previously we don't print out ends_line() words at all.
But soon a word might have some content plus a newline at
the end.
So restructure the display to print non-newline characters
from any word.
Note that we cannot have characters *after* a newline.
Doing that would break too much of wiggle's formating
assumptions.
NeilBrown [Fri, 1 Mar 2013 08:05:27 +0000 (19:05 +1100)]
Allow a word to have an unmatched prefix and suffix.
i.e. The part of a word that is tested for matching is
shorted than the whole word that is printed. There can
be a prefix and a suffix. In a future patch, an option
will be availble to include most spaces as prefix or suffix
of nearby non-space.
NeilBrown [Fri, 1 Mar 2013 07:46:00 +0000 (18:46 +1100)]
vpatch: restructure draw_mside.
We have the end-of-line handing code in the middle of
a 'while', and the only return from the function is at
the end of the eol handling. And there is nothing after the "while".
So move the eol handling code out of the while, and just put
a "break" in place of it.
NeilBrown [Fri, 1 Mar 2013 05:02:15 +0000 (16:02 +1100)]
merge: Remove noise from --show-wiggles output.
When --show-wiggles is used with whole files (current, orig, new) and
extraneous text in orig/new (Which isn't a change, so should be
ignored) is treated as a wiggle and causes a conflict to be shown.
Obviously not good.
So insist that any show-wiggle conflict contains at leas a Changed or
a Conflict. Also allow Changed and Unmatched to be 'near' each other,
not only on the same line, to signal a wiggle. Current 'near' measure
is 3 lines.
NeilBrown [Thu, 14 Feb 2013 06:31:18 +0000 (17:31 +1100)]
Add valgrind testing of parts of vpatch.
With --self-test, browsing a simple merge will simply
display at every line.
"make vtest" will run this for every merge in the test suite
and use valgrind to look for problems.